
// ------------------------ This is Active for Menu ----------------------------
$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
//$("ul.topnav li span").click(function() { //When trigger is clicked...

$("ul.topnav li a").mouseover(function() 
{		
	$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

	$(this).parent().hover(function(){}, function(){
		$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
	});
	
//$(this).parent().find("ul.subnav").hover(function(){$(this).addClass("subhover");},function(){$(this).removeClass("subhover");} );

}).hover(function() { 
		$(this).addClass("subhover"); //On hover over, add class "subhover"
	}, function(){	//On Hover Out
		$(this).removeClass("subhover"); //On hover out, remove class "subhover"
		});

//Remain hover status for ".parent_item"
$("ul.subnav").hover(
  function () {
	$(this).parent().find(".parent_item").addClass("subhover");
  },
  function () {
	$(this).parent().find(".parent_item").removeClass("subhover");
  }
 );

//*********************** This is active for tab ****************************
			
  //Get all the LI from the #tabMenu UL
  $('#tabMenu > li').click(function(){
		
	//remove the selected class from all LI    
	$('#tabMenu > li').removeClass('selected');
	
	//Reassign the LI
	$(this).addClass('selected');
	
	//Hide all the DIV in .box_content
	$('.box_content_tab div.tab_item_content').slideUp('1500');
	
	//Look for the right DIV in box_content according to the Navigation UL index, therefore, the arrangement is very important.				
	$('.box_content_tab div.tab_item_content:eq(' + $('#tabMenu > li').index(this) + ')').slideDown('1500');
	
  }).mouseover(function() {

	//Add and remove class, Personally I dont think this is the right way to do it, anyone please suggest    
	$(this).addClass('mouseover');
	$(this).removeClass('mouseout');   
	
  }).mouseout(function() {
	
	//Add and remove class
	$(this).addClass('mouseout');
	$(this).removeClass('mouseover');				
  });			
	

$("#carousel").featureCarousel({
          
        });

$('#product-body').carouFredSel({
					items:5,
					scroll:	{
						items:1,
						fx  : "scroll",
                    	easing : "swing",
                  		duration : 500,
					},
					
					auto: {
						pauseOnHover: 'resume',
						onPauseStart: function( percentage, duration ) {
							$(this).trigger( 'configuration', ['width', function( value ) { 
								$('#timer1').stop().animate({
									width: value
								}, {
									
									duration: duration,
									easing: 'linear'
								});
							}]);
						},
						
						onPauseEnd: function( percentage, duration ) {
							$('#timer1').stop().width( 0 );
						},
						onPausePause: function( percentage, duration ) {
							$('#timer1').stop();
						}
					}
				});
						
// ------------------------ This is Active for Carousel ----------------------------
jQuery('#mycarousel').jcarousel({
	auto: 0, /* 0 for not auto scroll */
	wrap: 'last',
	scroll: 1,
	initCallback: mycarousel_initCallback
});

function mycarousel_initCallback(carousel)
{
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});		
	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

// ------------------------ This is Active for Round Corner ----------------------------
$('.gallery_pic img').corner("5px");


	
